package org.dbpt.performance;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class RandomIntegerGenerator extends IntegerGenerator {

	public RandomIntegerGenerator() {
		super();
	}
	
	public RandomIntegerGenerator(int max) {
		super(max);
	}
	public RandomIntegerGenerator(int min, int max) {
		super(min, max);
	}

	@Override
	public void generate(PreparedStatement preparedStatement, int paramIdx) throws SQLException {
		int value = (int) (Math.random()* (getMax() - getMin()) - getMin());
		preparedStatement.setInt(paramIdx, value);
	}
	
}
